#include "ThreadPool.hpp"
#include "Task.hpp"
#include <ctime>
#include <cstdlib>
#include <unistd.h>


int main()
{
    srand((unsigned long)time(nullptr)^getpid());
    ThreadPool<Task>* tp = new ThreadPool<Task>();

    tp->run();

    while(true)
    {
        int x = rand()%100+1;
        usleep(2000);
        int y = rand()%30+1;
        Task t(x,y,[](int x,int y)->int{return x+y;});

        logMessage(DEBUG,"制作成功：%d+%d=?",x,y);
        tp->pushTask(t);

        sleep(1);
    }

    return 0;
}